package com.epam.xml.bank;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

@XmlRootElement
@XmlType(name = "client", propOrder = { "id", "name", "accounts" })
public class Client {
	
	private String login;
	
	private String password;
	private int id;
	private String name;
	@XmlElementWrapper(name="accounts")
	@XmlElement(name = "account")
	private List<Account> accounts=new ArrayList<Account>();
	
	public String getLogin() {
		return login;
	}
	@XmlAttribute
	public void setLogin(String login) {
		this.login = login;
	}
	public String getPassword() {
		return password;
	}
	@XmlAttribute
	public void setPassword(String password) {
		this.password = password;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name=name;
	}

	public List<Account> getAccounts() {
		return accounts;
	}
	public void addAccount(Account account) {
		accounts.add(account);
	}

	@Override
	public String toString() {
		return "Client [login=" + login + ", password=" + password + ", id="
				+ id + ", name=" + name + ", accounts=" + accounts + "]";
	}

}
